package net.xxcxcxcx.xc_enhancedmob.render.particle.summon.magic;

import net.fabricmc.api.EnvType;
import net.fabricmc.api.EnvironmentInterface;
import net.fabricmc.api.EnvironmentInterfaces;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.util.math.Vec3d;
import net.xxcxcxcx.xc_enhancedmob.render.particle.summon.BaseSummonParticle;

/**
 * 一个用于生成法术类粒子的基类
 */
@EnvironmentInterfaces(value = {@EnvironmentInterface(value = EnvType.CLIENT, itf = ClientWorld.class)})
public class BaseSummonMagicParticle extends BaseSummonParticle {

    public int spawntime;

    public BaseSummonMagicParticle() {
        super();
    }

    public BaseSummonMagicParticle(long t, Vec3d pos) {
        this(t, pos, 20);
    }

    public BaseSummonMagicParticle(long t, Vec3d pos, int spawntime) {
        super(t, pos);
        this.spawntime = spawntime;
    }

    public BaseSummonMagicParticle(PacketByteBuf buf) {
        read(buf);
    }

    @Override
    public void read(PacketByteBuf buf) {
        super.read(buf);
        spawntime = buf.readInt();
    }

    @Override
    public void write(PacketByteBuf buf) {
        super.write(buf);
        buf.writeInt(spawntime);
    }
}
